<?php
class UsersModel extends Model{
	protected $_validate = array(
		array("user_id","require","用户名不能为空！"),
		//array("user_id","unique","用户名已存在！"),
		//array("nick","require","昵称不能为空！"),
		array("password","require","密码不能为空！"),
		array("password","checkLength","密码长度至少6位！",0,'callback'),
		array("password","repassword","两次密码输入不一致！",0,'confirm'),
		);
	protected $_auto= array(
		array("password","md5",3,'function'),
		array("reg_time","getTime",3,'callback'),
		array("ip","getIp",3,'callback'),
		);
	function checkLength($data){
		if(strlen($data)<6){
			return false;
		} else return true;
	}
	function getIp(){
		return $_SERVER['REMOTE_ADDR'];
	}
	function getTime(){
		return date("Y-m-d H:i:s");
	}
}